﻿@model RTW.OA.Models.email_body
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutBase.cshtml";
}

@section styles{
    <link href="@Url.Content("~/Content/css/common/bootstrap-table/bootstrap-table.min.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/common/animate/animate.min.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/common/iCheck/custom.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/hplus/style.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/hplus/font-awesome.css?v=4.4.0")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/summernote/summernote-bs3.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/css/summernote/summernote.css")" rel="stylesheet" />
}
<div id="dMain">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox">
            <div class="ibox-content">
                <div class="row">
                    <div class="col-sm-12 animated fadeInRight">
                        <div style="margin-bottom:5px">
                            <a class="btn btn-sm btn-warning radius" onclick="backfrom()">
                                <i class="iconfont icon-fanhui"></i>
                                返回我的邮箱
                            </a>
                        </div>
                        <div class="mail-box-header">
                            <div class="pull-right tooltip-demo">
                                <a onclick="savedraftsfrom()" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="存为草稿"><i class="fa fa-pencil"></i> 存为草稿</a>
                                <a onclick="giveupclick()" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="放弃"><i class="fa fa-times"></i> 放弃</a>
                            </div>
                            <h2>
                                写信
                            </h2>
                        </div>
                        <div class="mail-box">
                            @using (Html.BeginForm("Edit", "EMail", FormMethod.Post, new { area = "Personal", id = "email_bodyfrom", name = "email_bodyfrom", @class = "form-horizontal" }))
                            {
                                @Html.AntiForgeryToken()
                                @Html.HiddenFor(m => m.BODY_ID)
                                <input id="SendsState" name="SendsState" value="" hidden />
                                <input id="Oldboxclass" name="Oldboxclass" value="@ViewData["boxclass"]" hidden/>
                                <div class="mail-body">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">收件人：</label>
                                        <div class="col-sm-9">
                                            @Html.EditorFor(m => m.TO_ID2)
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">抄送人：</label>
                                        <div class="col-sm-9">
                                            @Html.EditorFor(m => m.COPY_TO_ID)
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">密送人：</label>
                                        <div class="col-sm-9">
                                            @Html.EditorFor(m => m.SECRET_TO_ID)
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">重要程度:</label>
                                        <div class="col-sm-9">
                                            <div class="rule-single-select">@Html.DropDownListFor(m => m.IMPORTANT, ViewBag.IMPORTANTData as List<SelectListItem>, new { @Class = "form-control" })</div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">邮件主题:</label>
                                        <div class="col-sm-9">
                                            @Html.EditorFor(m => m.SUBJECT)
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">内容关键词:</label>
                                        <div class="col-sm-9">
                                            @Html.EditorFor(m => m.KEYWORD)
                                        </div>
                                        <label class="col-sm-2 control-label">邮件密级等级:</label>
                                        <div class="col-sm-9">
                                            @Html.EditorFor(m => m.SECRET_LEVEL)
                                        </div>
                                    </div>
                                </div>
                                <div class="mail-text h-200">
                                    @Html.TextAreaFor(m => m.CONTENT, new { @class = "editor" })
                                </div>
                            }
                            <div class="mail-body text-right tooltip-demo">
                                <a onclick="sendfrom()" class="btn btn-sm btn-primary" data-toggle="tooltip" data-placement="top" title="Send"><i class="fa fa-reply"></i> 发送</a>
                                <a onclick="giveupclick()" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Discard email"><i class="fa fa-times"></i> 放弃</a>
                                <a onclick="savedraftsfrom()" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Move to draft folder"><i class="fa fa-pencil"></i> 存为草稿</a>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script src="@Url.Content("~/Content/JS/common/WdatePicker/WdatePicker.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/jquery/Validform_v5.3.2_min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/artdialog/dialog-plus-min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/webuploader/webuploader.min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/ueditor.config.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/ueditor.all.min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/lang/zh-cn/zh-cn.js")"></script>
    @*<script type="text/javascript" charset="utf-8" src="../js/uploader.js"></script>*@
    <script src="@Url.Content("~/Content/JS/common/from.js")"></script>

    <script>
        //初始化表单验证
        $(function () {
            //初始化表单验证
            $("#email_bodyfrom").initValidform();
        });
        function sendfrom() {//发送
            $("#SendsState").val("1");
            $("#email_bodyfrom").submit();
        }
        function savedraftsfrom() {//草稿箱
            $("#SendsState").val("0");
            $("#email_bodyfrom").submit();
        }
        function giveupclick() {//放弃
           layer.confirm('确定放弃此邮件？', {
                btn: ['确定', '取消'] //按钮
           }, function () {
               location.href = "@Url.Action("Index", "EMail", new { area = "Personal" })";
            });
        }

        //初始化编辑器
        $(".editor").each(function (i) {
            var objId = $(this).attr("id");
            if (objId != "undefined") {
                var editor = UE.getEditor(objId, {
                    serverUrl: '../../../Ashx/Upload_ajax.ashx',
                    initialFrameWidth: '100%',
                    initialFrameHeight: 350
                });
            }
        });
        $(".editor-mini").each(function (i) {
            var objId = $(this).attr("id");
            if (objId != "undefined") {
                var editorMini = UE.getEditor(objId, {
                    serverUrl: '../../../Ashx/Upload_ajax.ashx',
                    initialFrameWidth: '100%',
                    initialFrameHeight: 250,
                    toolbars: [[
                        'fullscreen', 'source', '|', 'undo', 'redo', '|',
                        'bold', 'italic', 'underline', 'strikethrough', 'removeformat', 'pasteplain', '|', 'forecolor', 'insertorderedlist', 'insertunorderedlist', '|',
                        'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
                        'link', 'unlink', 'anchor', '|',
                        'simpleupload', 'insertimage', 'scrawl', 'insertvideo'
                    ]]
                });
            }
        });

        function backfrom() {
             location.href = "@Url.Action("Index", "EMail", new { area = "Personal" })";
        }
    </script>
}

